package com.ruoyi.web.controller.wnjk.app.registration;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.pay.service.IPayService;
import com.ruoyi.system.wnjk.domain.po.PhysicalOrder;
import com.ruoyi.system.wnjk.domain.po.WnjkRegistrationOrder;
import com.ruoyi.system.wnjk.service.IPhysicalService;
import com.ruoyi.system.wnjk.service.IWnjkPhysicalExaminationOrderService;
import com.ruoyi.system.wnjk.service.IWnjkRegistrationOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.ruoyi.common.core.domain.AjaxResult.success;

@RestController
@RequestMapping("/app/registration/order")
public class RegistrationOrdercontroller {

    @Autowired
    private IWnjkRegistrationOrderService wnjkRegistrationOrderService;


    // 获取挂号订单列表(根据用户id)
   @GetMapping(value = "/list/{id}")
    public AjaxResult getOrderList(@PathVariable String id){
        Long userId = Long.parseLong(id);
        return success(wnjkRegistrationOrderService.selectWnjkRegistrationOrderById(userId));
   }


   // 根据orderNumber获取挂号订单
   @GetMapping("/listByOutTradeNo/{orderNumber}")
    public AjaxResult getOrderListByOutTradeNo(@PathVariable String orderNumber){
        WnjkRegistrationOrder order = wnjkRegistrationOrderService.selectByOrderNumber(orderNumber);
        return success(order);
   }


}